require("./util.js"), require("./encode.js"), require("./md5.js");

var e = "https://testsvs.ap1983.com";

function t(e, t) {
    e.errMsg && e.errMsg.includes("timeout") ? t("太火爆了，服务器有点扛不住，稍后再试一下吧~") : t(e.errMsg);
}

function n(e, t, n, o) {
    200 !== e.statusCode ? n("http status code: " + e.statusCode) : !1 === e.data.success ? !0 === e.data.NeedLogin ? n("登录失效，请重新登录") : n(e.data.msg) : t(e.data);
}

function o(o, a, i) {
    return new Promise(function(r, s) {
        var u = e + "/" + o;
        i.action = a, wx.request({
            url: u,
            header: {
                "content-type": "application/text"
            },
            data: i,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}

exports.HOST = e, exports.getHost = function() {
    return e;
}, exports.delay = function(e, t, n) {
    return new Promise(function(o, a) {
        var i = new Date().getTime() - e;
        i >= t ? o(n) : setTimeout(function() {
            o(n);
        }, t - i);
    });
}, exports.phoneLogin = function(e, t, n, a) {
    return o("XCXJieKou.ashx", "GetXCXWeiXinInfoByCode", {
        code: e,
        encryptedData: t,
        iv: n,
        leixing: 0,
        fromUserID: a
    });
}, exports.codeLogin = function(e) {
    return o("XCXJieKou.ashx", "GetXCXUserInfoByCode", {
        code: e,
        leixing: 0
    });
}, exports.getRedDot = function(e, t) {
    return o("XCXJieKou.ashx", "GetXCXRedDot", {
        UserName: e,
        token: t
    });
}, exports.my = function(e, t) {
    return o("XCXJieKou.ashx", "GetXCXUserInfo", {
        UserName: e,
        token: t
    });
}, exports.wxMemberCard = function(e, t) {
    return o("XCXJieKouUser.ashx", "GetXCXWeiXinMember", {
        UserName: e,
        token: t
    });
}, exports.updateUserInfo = function(e, t, n, a, i) {
    return o("XCXJieKouUser.ashx", "UpdateXCXUserInfoByWx", {
        UserName: e,
        token: t,
        code: n,
        encryptedData: a,
        iv: i,
        leixing: 0
    });
}, exports.shareFrom = function(e, t, n, a) {
    return o("XCXJieKouDrawBox.ashx", "ShareXCXRFrom", {
        UserName: e,
        token: t,
        fromType: n,
        fromUserID: a
    });
}, exports.homeNew = function(e, t) {
    var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
    return o("XCXJieKou.ashx", "GetXCXFashionPlayIndex", {
        UserName: e,
        token: t,
        dx: n,
        IPID: a
    });
}, exports.homeRefresh = function(e, t) {
    return o("XCXJieKouDrawBox.ashx", "GetXCXDrawBoxRefresh", {
        UserName: e,
        token: t
    });
}, exports.seriesList = function(e, t, n) {
    return o("XCXJieKou.ashx", "GetFashionPlayList", {
        IPID: e,
        pageCurrent: t,
        pageSize: n
    });
}, exports.sendAgreement = function() {
    return o("XCXJieKouDrawBox.ashx", "GetXCXDeliveryAgreement", {});
}, exports.shopOrderCreate = function(e, t, n, a, i, r, s) {
    return o("XCXJieKouShopMall.ashx", "CreateXCXShoppingMallUnifiedTrade", {
        UserName: e,
        token: t,
        ShoppingMallID: n,
        Quantity: a,
        Amount: i,
        UserCouponID: r,
        PointAmount: s
    });
}, exports.shopOrderCancel = function(e, t, n) {
    return o("XCXJieKouShopMall.ashx", "SureFaileXCXShoppingMallPay", {
        UserName: e,
        token: t,
        out_trade_no: n
    });
}, exports.getCouponByAmount = function(e, t, n, a) {
    return o("XCXJieKouShopMall.ashx", "GetXCXBuyUserInfo", {
        UserName: e,
        token: t,
        Amount: n,
        productJsonList: a
    });
}, exports.seriesBoxDetail = function(e, t, n, a, i) {
    return o("XCXJieKouDrawBox.ashx", "GetXCXDrawBoxGame", {
        UserName: e,
        token: t,
        DrawBoxID: n,
        PDLineUpID: a,
        Refresh: i
    });
}, exports.seriesPresellDetail = function(e) {
    return o("XCXJieKouDrawBox.ashx", "GetXCXDrawBoxDetail", {
        DrawBoxID: e
    });
}, exports.seriesBoxJoin = function(e, t, n) {
    return o("XCXJieKouDrawBox.ashx", "JoinXCXDrawBoxPDInLine", {
        UserName: e,
        token: t,
        PDLineUpID: n
    });
}, exports.seriesBoxCancelJoin = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "ExitXCXDrawBoxPDInLine",
            UserName: o,
            token: a,
            PDInLineID: i
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.seriesModelDetail = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "GetXCXDrawBoxPage",
            UserName: o,
            token: a,
            PDLineUpID: i,
            SortID: r
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.seriesModelShake = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "UseXCXDrawBoxPDShakeIt",
            UserName: o,
            token: a,
            PDLineUpID: i,
            SortID: r
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.modelUseCard = function(o, a, i, r, s) {
    return new Promise(function(u, c) {
        var f = {
            action: 1 == s ? "UseXCXDrawBoxPDTipsCard" : "UseXCXDrawBoxPDDisplayCard",
            UserName: o,
            token: a,
            PDLineUpID: i,
            SortID: r
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: f,
            success: function(e) {
                n(e, u, c);
            },
            fail: function(e) {
                t(e, c);
            }
        });
    });
}, exports.modelOpen = function(o, a, i, r, s, u) {
    return new Promise(function(c, f) {
        var p = {
            action: "GetXCXDrawBoxOpening",
            UserName: o,
            token: a,
            PDInLineID: i,
            PDLineUpID: r,
            SortID: s,
            out_trade_no: u
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: p,
            success: function(e) {
                e && e.data && e.data.Info && (!1 === e.data.Info.hasAddress || e.data.Info.priceInfo) ? c(e.data) : n(e, c, f);
            },
            fail: function(e) {
                t(e, f);
            }
        });
    });
}, exports.modelOpenContinue = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GoonXCXDrawBoxPDInLine",
            UserName: o,
            token: a,
            PDInLineID: i
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.addressSave = function(o, a, i, r, s, u, c, f, p, x) {
    return new Promise(function(l, X) {
        var d = {
            action: i ? "UpdateAddress" : "AddAddress",
            UserName: o,
            token: a,
            ID: i,
            NikeName: s,
            Mobile: u,
            Province: c,
            City: f,
            Area: p,
            Address: x,
            Zip: "",
            IsDefault: r
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: d,
            success: function(e) {
                n(e, l, X);
            },
            fail: function(e) {
                t(e, X);
            }
        });
    });
}, exports.addressList = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXAddress",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.addressDelete = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "DeleteAddress",
            UserName: o,
            token: a,
            ID: i
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.buyOpenTimes = function(o, a, i, r, s, u) {
    return new Promise(function(c, f) {
        var p = {
            action: "CreateXCXOpenBoxUnifiedTrade",
            UserName: o,
            token: a,
            DrawBoxID: i,
            Quantity: r,
            Amount: s,
            UserCouponID: u
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: p,
            success: function(e) {
                n(e, c, f);
            },
            fail: function(e) {
                t(e, f);
            }
        });
    });
}, exports.checkPayState = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "SearchXCXOpenBoxPay",
            UserName: o,
            token: a,
            out_trade_no: i
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.getPayData = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "GetwxJsApiParam",
            UserName: o,
            token: a,
            miniOpenID: i,
            out_trade_no: r
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.cancelBuy = function(o, a, i, r, s, u) {
    return new Promise(function(c, f) {
        var p = {
            action: "SureFaileXCXOpenBoxPay",
            UserName: o,
            token: a,
            OpenBoxID: i,
            Quantity: r,
            Amount: s,
            out_trade_no: u
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: p,
            success: function(e) {
                n(e, c, f);
            },
            fail: function(e) {
                t(e, f);
            }
        });
    });
}, exports.wishDetailList = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "GetXCXWishDetailed",
            UserName: o,
            token: a,
            pageCurrent: i,
            pageSize: r
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.forbidden = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXBlackList",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.commrequest = function() {
    var o = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, a = arguments.length > 1 ? arguments[1] : void 0, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
    return 1 == i && wx.showLoading({
        title: "加载数据中"
    }), new Promise(function(i, r) {
        wx.request({
            url: e + a,
            header: {
                "content-type": "application/text"
            },
            data: o,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                wx.showToast({
                    title: "获取数据失败",
                    icon: "loading",
                    duration: 2e3
                }), t(e, r);
            },
            complete: function() {
                wx.hideLoading();
            }
        });
    });
}, exports.trySeriesDetail = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXTestDrawBoxGame",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.tryModelDetail = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXTestDrawBoxPage",
            UserName: o,
            token: a,
            id: i
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.tryModelShake = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "UseXCXTestDrawBoxPDShakeIt",
            UserName: o,
            token: a,
            id: i
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.tryModelOpen = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXTestDrawBoxOpening",
            UserName: o,
            token: a,
            id: i
        };
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.luckyBagDetail = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXLuckyBagGame",
            UserName: o,
            token: a,
            LuckyBagID: i
        };
        wx.request({
            url: e + "/XCXJieKouLuckyBag.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.luckyBagOpen = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXLuckyBagOpening",
            UserName: o,
            token: a,
            LuckyBagID: i
        };
        wx.request({
            url: e + "/XCXJieKouLuckyBag.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                e && e.data && e.data.Info && (!1 === e.data.Info.hasAddress || e.data.Info.priceInfo) ? r(e.data) : n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.wishRule = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: {
                action: "GetXCXWishRuleAgreement"
            },
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
}, exports.balance = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXUserBalance",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.balanceList = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "GetUserBalanceList",
            UserName: o,
            token: a,
            pageCurrent: i,
            pageSize: r,
            jsonWhere: ""
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.barrage = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/XCXJieKouDrawBox.ashx",
            header: {
                "content-type": "application/text"
            },
            data: {
                action: "GetXCXBarrageList"
            },
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
}, exports.shareInfo = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXShareInfo",
            UserName: o,
            token: a,
            fromType: i
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.cabinetShareInfo = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXBoxCabinetShare",
            UserName: o,
            token: a,
            BoxCabinetID: i
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.messageList = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "GetXCXMessageList",
            UserName: o,
            token: a,
            pageCurrent: i,
            pageSize: r
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.messageRead = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "MarkXCXMessageRead",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.messageQuery = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "existXCXUnreadMessage",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.dataReport = function(o, a, i, r, s, u) {
    return new Promise(function(c, f) {
        var p = {
            action: "MarkXCXUserVisit",
            leixing: 0,
            UserName: s,
            token: u,
            pagepath: i,
            pageparams: r,
            pageevent: a,
            pagename: o
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: p,
            success: function(e) {
                n(e, c, f);
            },
            fail: function(e) {
                t(e, f);
            }
        });
    });
}, exports.scanGift = function(o, a, i, r, s) {
    return new Promise(function(u, c) {
        var f = {
            action: "GetXCXScanCodeGiveGift",
            UserName: o,
            token: a,
            BreCodeID: i,
            timestamp: r,
            sign: s
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: f,
            success: function(e) {
                n(e, u, c);
            },
            fail: function(e) {
                t(e, c);
            }
        });
    });
}, exports.expressDetail = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetLogisticsTrackingInfo",
            UserName: o,
            token: a,
            ExpressNo: i
        };
        wx.request({
            url: e + "/XCXJieKouOrder.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.kefuImage = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/XCXJieKouOrder.ashx",
            header: {
                "content-type": "application/text"
            },
            data: {
                action: "GetCustomerServicePictures"
            },
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
}, exports.freeTakeDetail = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "LoadXCXTakeFreeBox",
            UserName: o,
            token: a,
            HelpUserID: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.freeTakeDraw = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "DrawkeFreeBox",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.freeTakeHelpe = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "HelpakeFreeBox",
            UserName: o,
            token: a,
            HelpUserID: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.activityList = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: {
                action: "GetXCXActivityList"
            },
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
}, exports.newUserHome = function(o, a, i, r, s) {
    return new Promise(function(u, c) {
        var f = {
            action: "GetXCXNewRecruitsList",
            UserName: o,
            token: a,
            id: i,
            pageCurrent: r,
            pageSize: s
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: f,
            success: function(e) {
                n(e, u, c);
            },
            fail: function(e) {
                t(e, c);
            }
        });
    });
}, exports.newUserRule = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/BLindBoxSel.asmx/GetXCXNewRecruitsRuleAgreement",
            header: {
                "content-type": "application/text"
            },
            data: {},
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
}, exports.followGzhHome = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "LoadXCXDoubleAct",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.followGzhOpen = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXSubscribeOpened",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.limitCouponOpen = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXRobTicketOpened",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.newYearHome = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXChunJieActIng",
            UserName: o,
            token: a,
            id: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.newYearOrder = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "CreateXCXChunJieUnifiedTrade",
            UserName: o,
            token: a,
            ChunJieID: i,
            productJsonList: r
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.newYearCanelOrder = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "SureFaileXCXChunJiePay",
            UserName: o,
            token: a,
            ChunJieID: i,
            out_trade_no: r
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.cabinetList = function(o, a, i, r, s, u) {
    return new Promise(function(c, f) {
        var p = {
            action: "GetXCXBoxCabinetPage",
            UserName: o,
            token: a,
            item: i,
            merge: r,
            pageCurrent: s,
            pageSize: u
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: p,
            success: function(e) {
                n(e, c, f);
            },
            fail: function(e) {
                t(e, f);
            }
        });
    });
}, exports.cabinetSend = function(o, a, i, r, s) {
    return new Promise(function(u, c) {
        var f = {
            action: "DeliveryXCXBoxCabinet",
            UserName: o,
            token: a,
            prouctJson: i,
            addressID: r,
            PostalCouponID: s
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: f,
            success: function(e) {
                n(e, u, c);
            },
            fail: function(e) {
                t(e, c);
            }
        });
    });
}, exports.cabinetPayForExpress = function(o, a, i, r, s) {
    return new Promise(function(u, c) {
        var f = {
            action: "CreateXCXBoxCabinetUnifiedTrade",
            UserName: o,
            token: a,
            prouctJson: i,
            addressID: r,
            expressID: s
        };
        wx.request({
            url: e + "/XCXJieKou.ashx",
            header: {
                "content-type": "application/text"
            },
            data: f,
            success: function(e) {
                n(e, u, c);
            },
            fail: function(e) {
                t(e, c);
            }
        });
    });
}, exports.pointList = function(o, a, i, r) {
    return new Promise(function(s, u) {
        var c = {
            action: "GetXCXUserPointDetail",
            UserName: o,
            token: a,
            pageCurrent: i,
            pageSize: r
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: c,
            success: function(e) {
                n(e, s, u);
            },
            fail: function(e) {
                t(e, u);
            }
        });
    });
}, exports.pointRule = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: {
                action: "GetXCXIntegralRule"
            },
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
}, exports.setting = function(o, a) {
    return new Promise(function(i, r) {
        var s = {
            action: "GetXCXUserSet",
            UserName: o,
            token: a
        };
        wx.request({
            url: e + "/XCXJieKouUser.ashx",
            header: {
                "content-type": "application/text"
            },
            data: s,
            success: function(e) {
                n(e, i, r);
            },
            fail: function(e) {
                t(e, r);
            }
        });
    });
}, exports.oneFreeActHome = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXBuyOneFreeActIng",
            UserName: o,
            token: a,
            id: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.grilActHome = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "GetXCXGirlHoodActIng",
            UserName: o,
            token: a,
            id: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.grilActSubscribe = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "AddXCXActSubscribe",
            UserName: o,
            token: a,
            ActID: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.grilActOrderCreate = function(o, a, i, r, s, u) {
    return new Promise(function(c, f) {
        var p = {
            action: "CreateXCXActUnifiedTrade",
            UserName: o,
            token: a,
            ActID: i,
            Amount: r,
            DiscountAmount: s,
            productJsonList: u
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: p,
            success: function(e) {
                n(e, c, f);
            },
            fail: function(e) {
                t(e, f);
            }
        });
    });
}, exports.grilActOrderCancel = function(o, a, i) {
    return new Promise(function(r, s) {
        var u = {
            action: "SureFaileXCXActPay",
            UserName: o,
            token: a,
            out_trade_no: i
        };
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: u,
            success: function(e) {
                n(e, r, s);
            },
            fail: function(e) {
                t(e, s);
            }
        });
    });
}, exports.mallProduct = function(o, a, i, r, s) {
    return new Promise(function(u, c) {
        var f = {
            action: "GetXCXShoppingMallDetail",
            UserName: o,
            token: a,
            ShoppingMallID: i,
            itemno: r,
            ipid: s
        };
        wx.request({
            url: e + "/XCXJieKouShopMall.ashx",
            header: {
                "content-type": "application/text"
            },
            data: f,
            success: function(e) {
                n(e, u, c);
            },
            fail: function(e) {
                t(e, c);
            }
        });
    });
}, exports.actNewUserGift = function() {
    return new Promise(function(o, a) {
        wx.request({
            url: e + "/XCXJieKouActivity.ashx",
            header: {
                "content-type": "application/text"
            },
            data: {
                action: "GetXCXIndexNewGiftPack"
            },
            success: function(e) {
                n(e, o, a);
            },
            fail: function(e) {
                t(e, a);
            }
        });
    });
};